package com.csi.jf.crucible.pro.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.chinasofti.ro.bizframework.core.orm.IDAO;
import com.csi.jf.crucible.common.model.JfTUser;
import com.csi.jf.crucible.common.service.LoginService;
import com.csi.jf.crucible.pro.service.WorkbenchService;
import com.csi.jf.crucible.ptservice.model.PTSTask;

/**
 * <p>Service Impl</p>
 * 
 * @author BizFoundation
 * @version 5.0
 * @since 1.0
 */
public class WorkbenchServiceImpl implements WorkbenchService {
	private IDAO dao;
	
	public void setDao(IDAO dao) {
		this.dao = dao;
	}
	
	@Override
	public List<PTSTask> findTaskByJfID(Long jfID) {
		PTSTask task = new PTSTask();
		task.setPersonId(Long.valueOf(jfID));
		List<PTSTask> tasklist = dao.createQuery(task).list();
		return tasklist;
	}

	@Override
	public void operateTask(String type,String taskId) {
		  String status = "";
		  if(type!=null){
 		  switch(Integer.valueOf(type)){
			case 0: status="0";//接受
			break;
			case 1: status="2";//拒绝
			break;
			case 2: status="4";//确认收款
			break;
		  }}
 		  PTSTask task = new PTSTask();
 		  if(taskId!=null)
 	      task.setTaskId(Long.valueOf(taskId));
 		  task.setStatus(status);
 		  dao.update(task); 	      
	}

	@Override
	/**
	 * 通过reviewid更新其状态
	 */
	public void updateReviewStatus(String reviewId,String status) {
		 String sql = "Update jf_pts_cru_reviews set status=? where id=?";
	     dao.execute(sql, new String[]{reviewId,status});
	}

}